<template>
    <div class="userinfo">
        <div class="congtainer">
            <div class="pages-account-settings-info-main">
                <!-- <el-input type='number' min="0"></el-input> -->
                <el-menu :default-active="activeIndex" class="el-menu-vertical-demo"  @select="handleSelect">
                    <el-menu-item index="1">基本设置</el-menu-item>
                    <el-menu-item index="2" v-if="globalUserInfo && globalUserInfo.roleId == '0'">账户设置</el-menu-item>
                    <el-menu-item index="3">账号绑定</el-menu-item>
                    <!-- <el-menu-item index="4">新消息通知</el-menu-item> -->
                    <el-menu-item v-if="globalUserInfo && globalUserInfo.jobSeeker !== null" index="5">简历设置</el-menu-item>
                    <el-menu-item v-if="globalUserInfo && globalUserInfo.roleId == '1'" index="6">职位发布</el-menu-item>
                </el-menu>
                
                <div class="main">
                  <!-- 求职者基本信息 -->
                <template v-if="globalUserInfo && globalUserInfo.jobSeeker !== null && activeIndex == '1'">

                  <div class="pages-account-settings-base-view-left">
                      <div class="pages-account-settings-info-title">基本设置</div>
                      <!-- <div class="ant-row ant-form-item" v-for="(item, index) in basicInformatioList" :key="index">
                          <div class="ant-form-item-label">
                              <label class="ant-form-item-required">{{item.title}}</label>
                          </div>
                          <el-input v-if="item.type == 'text'" :type="item.intertype" v-model="basicInformatio[item.model]" :placeholder="'请输入'+item.title"></el-input>
                          <div v-if="item.type == 'radio'">
                              <el-radio v-model="basicInformatio[item.model]" label="男">男</el-radio>
                              <el-radio v-model="basicInformatio[item.model]" label="女">女</el-radio>
                          </div>
                      </div> -->
                      <UpdateFrom :list="basicInformatioList" :model="basicInformatio"></UpdateFrom>
                      <el-button type="primary" size="small" @click="handleJobSeekerUpdate">更新基本信息</el-button>
                  </div>

                  <div class="pages-account-settings-base-view-right">
                      <div style="opacity: 0;" class="pages-account-settings-info-title">基本设置</div>
                      <div class="ant-row ant-form-item">
                          <div class="ant-form-item-label">
                              <label class="ant-form-item-required">头像</label>
                          </div>

                          <div class="pages-account-settings-base-view-avatar">
                              <img 
                              :src="basicInformatio.avatar !== null && basicInformatio.avatar !== '' ? BASEURL +  basicInformatio.avatar:'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png'" alt="avatar">
                          </div>
                          <div class="pages-account-upload">
                              
                              <el-upload
                                class="upload-demo"
                                :action="BASEURL+ '/api/jobSeeker/updateAvatar'"
                                :on-success="handleUpdateAvatarSuccess"
                                :on-error="handleUpdateAvatarError"
                                :data="{userId: globalUserInfo.jobSeeker.userId}"
                                :headers="{token,}"
                                name="upload"
                                multiple
                                :show-file-list="false"
                                >
                                <el-button slot="trigger" size='mini' ><i class="el-icon-upload el-icon--left"></i>上传</el-button>
                              </el-upload>
                          </div>
                          
                      </div>
                  </div>

                </template>

                 <!-- 求职者账户信息 -->
                 <template v-if="globalUserInfo && globalUserInfo.jobSeeker !== null && activeIndex == '2'">
                    <div>
                        <div class="pages-account-settings-base-view-left">
                            <div class="pages-account-settings-info-title">账户设置</div>
                            <!-- <div class="ant-row ant-form-item" v-for="(item, index) in basicInformatioAccountList" :key="index">
                                <div class="ant-form-item-label">
                                    <label class="ant-form-item-required">{{item.title}}</label>
                                </div>
                                <el-input v-if="item.type == 'text'" :type="item.intertype" v-model="basicInformatioAccount[item.model]" :placeholder="'请输入'+item.title"></el-input>
                            </div>-->
                            <UpdateFrom :list="basicInformatioAccountList" :model="basicInformatioAccount"></UpdateFrom>
                            <el-button type="primary" size="small" @click="handleJobSeekerAccountUpdate">更新账户信息</el-button>
                            <el-button type="primary" size="small" @click="handleJobSeekerUpdatePassword">修改密码</el-button> 
                            
                        </div>
                    </div>
                    
                 </template>

                 <!-- 求职者简历设置 -->
                 <template v-if="globalUserInfo && globalUserInfo.jobSeeker !== null && activeIndex == '5'">
                    <div v-if="resumeList.length == 0">
                        <el-button  type="text" @click="handleAddResume">暂无简历，请添加简历</el-button>
                    </div>
                    <template v-if="resumeList.length > 0">

                        <div class="pages-account-settings-base-view-left">
                            <div class="pages-account-settings-info-title">简历设置</div>
                            <UpdateFrom :list="resumePropsList" :model="resumeModel"></UpdateFrom>
                            <el-button type="primary" size="small" @click="handleresumeUpdate">更新简历信息</el-button>
                        </div>

                        <div class="pages-account-settings-base-view-right">

                            <div class="ant-row ant-form-item">
                            <div class="ant-form-item-label">
                                <label class="ant-form-item-required">个人照片</label>
                            </div>

                            <div class="pages-account-settings-base-view-avatar">
                                <img 
                                :src="resumeModel.photo !== null ? BASEURL + resumeModel.photo:''" alt="未上传照片">
                            </div>
                            <div class="pages-account-upload">
                                
                                <el-upload
                                    class="upload-demo"
                                    :action="BASEURL+ `/api/resume/uploadPhoto`"
                                    :on-success="handlePersonalPhotoSuccess"
                                    :on-error="handleUpdateAvatarError"
                                    :headers="{token,}"
                                    name="upload"
                                    multiple
                                    :show-file-list="false"
                                    >
                                    <el-button slot="trigger" size='mini' ><i class="el-icon-upload el-icon--left"></i>上传照片</el-button>
                                </el-upload>
                            </div>
                            </div>

                        </div>
                        <div>
                            <p style="cursor: pointer;" @click="handleResumeSetDefault">设为默认简历</p>
                            <el-button type="text" @click="handleAddResume">添加简历</el-button>
                            <div style="margin-top: 5px">
                                <el-radio-group v-model="resumeListRadio" @change="hanldeResumeListRadioChange" size="small">
                                    <div v-for="(item,index) in resumeList" :key="index">
                                      <el-radio style="margin-top:15px;" :label="index" border>{{item.param1}}</el-radio>
                                      <el-popover
                                        placement="top"
                                        width="160"
                                        v-model="deleteResumeInform[index]">
                                        <p>确定要删除{{item.param1}}么？</p>
                                        <div style="text-align: right; margin: 0">
                                            <el-button size="mini" type="text" @click="deleteResumeInform[index] = false">取消</el-button>
                                            <el-button type="primary" size="mini" @click="deleteResumeInformSure(item,index)">确定</el-button>
                                        </div>
                                        <i slot="reference" class="el-icon-close"></i>
                                        </el-popover>
                                      <br/>
                                    </div>
                                </el-radio-group>
                            </div>
                        </div>

                    </template>

                    <el-dialog title="新增简历" :visible.sync="dialogAddResumeForm" width="80%">
                        <div class="main">
                            
                        <div class="pages-account-settings-base-view-left">
                            <UpdateFrom :list="resumePropsList" :model="resumeAddModel"></UpdateFrom>
                            
                        </div>

                        <div class="pages-account-settings-base-view-right">

                            <div class="ant-row ant-form-item">
                            <div class="ant-form-item-label">
                                <label class="ant-form-item-required">个人照片</label>
                            </div>

                            <div class="pages-account-settings-base-view-avatar">
                                <img 
                                :src="resumeAddModel.photo !== null ? BASEURL + resumeAddModel.photo:''" alt="未上传照片">
                            </div>
                            <div class="pages-account-upload">
                                
                                <el-upload
                                    class="upload-demo"
                                    :action="BASEURL+ `/api/resume/uploadPhoto`"
                                    :on-success="handleAddPersonalPhotoSuccess"
                                    :on-error="handleUpdateAvatarError"
                                    :headers="{token,}"
                                    name="upload"
                                    multiple
                                    :show-file-list="false"
                                    >
                                    <el-button slot="trigger" size='mini' ><i class="el-icon-upload el-icon--left"></i>上传照片</el-button>
                                </el-upload>
                            </div>
                            </div>

                        </div>
                        </div>

                        <div slot="footer" class="dialog-footer">
                            <el-button  size="small" @click="handleResumeAddCancel">取 消</el-button>
                            <el-button  size="small" type="primary" @click="handleResumeAdd">保存</el-button>
                            </div>
                    </el-dialog>
                 </template>

                
                <!-- 企业基本信息修改 -->
                <template v-if="globalUserInfo && globalUserInfo.company !== null && activeIndex == '1'">
            
                  <div class="pages-account-settings-base-view-left">
                      <div class="pages-account-settings-info-title">基本设置</div>
                      <UpdateFrom :list="enterprisebasicInformatioList" :model="enterprisebasicInformatio"></UpdateFrom>
                      <el-button type="primary" size="small" @click="handleCompanybasicUpdate">更新基本信息</el-button>
                  </div>

                  <div class="pages-account-settings-base-view-right">
                      <div style="opacity: 0;" class="pages-account-settings-info-title">基本设置</div>
                      <div class="ant-row ant-form-item">
                          <div class="ant-form-item-label">
                              <label class="ant-form-item-required">公司LOGO</label>
                          </div>

                          <div class="pages-account-settings-base-view-avatar">
                              <img 
                              :src="enterprisebasicInformatio.logo !== null &&  enterprisebasicInformatio.logo !== '' ?  BASEURL + enterprisebasicInformatio.logo:'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png'" alt="avatar">
                          </div>
                          <div class="pages-account-upload">
                              
                              <el-upload
                                class="upload-demo"
                                :action="BASEURL+ `/api/company/updateLogo`"
                                :on-success="handleUpdateAvatarSuccess"
                                :on-error="handleUpdateAvatarError"
                                :data="{userId: globalUserInfo.userId, comId:globalUserInfo.company.comId}"
                                :headers="{token,}"
                                name="upload"
                                multiple
                                :show-file-list="false"
                                >
                                <el-button slot="trigger" size='mini' ><i class="el-icon-upload el-icon--left"></i>上传公司LOGO</el-button>
                              </el-upload>
                          </div>
                        </div>

                        <div class="ant-row ant-form-item">
                          <div class="ant-form-item-label">
                              <label class="ant-form-item-required">营业执照</label>
                          </div>

                          <div class="pages-account-settings-base-view-avatar">
                              <img 
                              :src="enterprisebasicInformatio.licence !== null && enterprisebasicInformatio.licence !== '' ?  BASEURL + enterprisebasicInformatio.licence:''" alt="未上传营业执照">
                          </div>
                          <div class="pages-account-upload">
                              
                              <el-upload
                                class="upload-demo"
                                :action="BASEURL+ `/api/company/updateLicence`"
                                :on-success="handleUpdateAvatarSuccess"
                                :on-error="handleUpdateAvatarError"
                                :data="{userId: globalUserInfo.userId, comId:globalUserInfo.company.comId}"
                                :headers="{token,}"
                                name="upload"
                                multiple
                                :show-file-list="false"
                                >
                                <el-button slot="trigger" size='mini' ><i class="el-icon-upload el-icon--left"></i>上传营业执照</el-button>
                              </el-upload>
                          </div>
                        </div>

                          
                      </div>
                    
                </template>

                <!-- 求职者账户信息 -->
                 <template v-if="globalUserInfo && globalUserInfo.company !== null && activeIndex == '2'">
                    <div>
                        <div class="pages-account-settings-base-view-left">
                            <div class="pages-account-settings-info-title">公司账户设置</div>
                            <!-- <div class="ant-row ant-form-item" v-for="(item, index) in basicInformatioAccountList" :key="index">
                                <div class="ant-form-item-label">
                                    <label class="ant-form-item-required">{{item.title}}</label>
                                </div>
                                <el-input v-if="item.type == 'text'" :type="item.intertype" v-model="basicInformatioAccount[item.model]" :placeholder="'请输入'+item.title"></el-input>
                            </div>-->
                            <UpdateFrom :list="enterpriseBasicInforAccountList" :model="enterpriseBasicInforAccount"></UpdateFrom>
                            <el-button type="primary" size="small" @click="handleJobSeekerAccountUpdate">更新账户信息</el-button>
                            <el-button type="primary" size="small" @click="handleJobSeekerUpdatePassword">修改密码</el-button> 
                            
                        </div>
                    </div>
                    
                 </template>

                 <!-- 职位相关 -->

                 <template v-if="globalUserInfo && globalUserInfo.roleId == '1' && activeIndex == '6'">
                    <!-- <div class="pages-account-settings-base-view-left">
                        312
                    </div>
                    <div class="pages-account-settings-base-view-right">
                    </div> -->
                    <PositionCorrelation></PositionCorrelation>
                 </template>

                 <template v-if="globalUserInfo && activeIndex == '3'">
                     <div>此功能需等项目上线提各平台申请</div>
                 </template>

                </div>
                
            </div>
        </div>
    </div>
</template>

<script>
import { BASEURL } from "../api";
import {systemMaintenance } from '../common/utils'
import UpdateFrom from '../components/UpdateFrom.vue'
import PositionCorrelation from '../components/PositionCorrelation.vue'

export default {
    data(){
      return {
        activeIndex: '1',
        basicInformatio: {      //求职者基本信息设置
          email: '',
          name: '',
          age: '',
          gender: '男',
          avatar: '',
          param1: ''
        },
        basicInformatioList: [
            { title: '姓名', model: 'name', type: 'text', intertype:"text" },
            { title: '年龄', model: 'age', type: 'text', intertype:"number" },
            { title: '性别', model: 'gender', type: 'radioGender', intertype:"" },
            { title: '邮箱', model: 'email', type: 'text', intertype:"email" },
            { title: '求职名称', model: 'param1', type: 'text', intertype:"text" },
        ],

        basicInformatioAccount: {       //求职者账户信息设置
            userId: '',
            username: '',
            roleId: '',
            password: '',
            mobile: '',
            status: '',
            createTime: '',
        },

        basicInformatioAccountList: [
            { title: '用户名', model: 'username', type: 'text', intertype:"text" },
            { title: '手机号', model: 'mobile', type: 'text', intertype:"number" },
            // { title: '验证码', model: 'code', type: 'text', intertype:"number" },
        ],

        enterpriseBasicInforAccount: {       //公司账户信息设置
            userId: '',
            username: '',
            roleId: '',
            password: '',
            mobile: '',
            status: '',
            createTime: '',
        },

        enterpriseBasicInforAccountList: [
            { title: '姓名', model: 'name', type: 'text', intertype:"text" },
            { title: '年龄', model: 'age', type: 'text', intertype:"number" },
            { title: '性别', model: 'gender', type: 'radioGender', intertype:"text" },
            { title: '用户名', model: 'username', type: 'text', intertype:"text" },
            { title: '手机号', model: 'mobile', type: 'text', intertype:"number" },
            // { title: '验证码', model: 'code', type: 'text', intertype:"number" },
        ],

        enterprisebasicInformatio: {        //企业信息设置
            "comId": "",
            "name": "",
            "introduce": "",
            "address": "",
            "linkman": "",
            "logo": "",
            "corporation": "",
            "licence": "",
            "createTime": "",
            "level": "",
            "authStatus": ""
        },

        enterprisebasicInformatioList: [
            { title: '公司名称', model: 'name', type: 'text', intertype:"text" },
            { title: '公司法人', model: 'corporation', type: 'text', intertype:"text" },
            { title: '企业规格', model: 'level', type: 'text', intertype:"text" },
            { title: '企业状态', model: 'authStatus', type: 'state', intertype:"number", disabled: true,
              data: [
                  { label: '未认证', value: 0 },
                  { label: '待认证', value: 1 },
                  { label: '已通过', value: 2 },
                  { label: '未通过', value: 3 },
              ]
             },
        ],

        BASEURL,
        token: '',
        resumeList:'',

        resumeModel: {      //求职者简历信息
            "resumeId":"74b7dd6aa2b54611a16a5230c57d74a9",
            "name":"xxx",
            "age": "12",
            "gender":"男",
            "education": '',
            "specialty":"土木工程",
            "arrivalTime":"2019-01-01",
            "registerAddress":"吉林省长春市",
            "currAddress":"吉林省长春市",
            "mobile":"13333333333",
            "email":"xxxxx@xxx.xxx",
            "educationDetail":"教育经历",
            "evaluation":"自我评价",
            "jobNature":"全职",
            "jobArea":"长春",
            "jobType":"工作类型",
            "jobName":"工程师",
            "salary":"5000-10000",
            "experience":"3",
            "experienceDetail":"工作经历",
            "openStatus":"1",
            "param1":"备用",
            "param2":"备用",
            "param3":"备用",
            "idCard":"22022222222222222222",
            "photo":"xxx.png",
            "auditStatus": "1"
        },
        resumePropsList: [
            { title: '简历名称', model: 'param1', type: 'text', intertype:"text" },
            { title: '姓名', model: 'name', type: 'text', intertype:"text" },
            { title: '年龄', model: 'age', type: 'text', intertype:"text" },
            { title: '性别', model: 'gender', type: 'text', intertype:"text" },
            { title: '学历', model: 'education', type: 'state', intertype:"text",
              data: [
                  { label: '小学', value: '0' },
                  { label: '初中', value: '1' },
                  { label: '高中', value: '2' },
                  { label: '大专', value: '3' },
                  { label: '本科', value: '4' },
                  { label: '硕士', value: '5' },
                  { label: '博士', value: '6' },
              ]
             },
             { title: '专业', model: 'specialty', type: 'text', intertype:"text" },
             { title: '到岗时间', model: 'arrivalTime', type: 'text', intertype:"text" },
             { title: '户籍所在地', model: 'registerAddress', type: 'text', intertype:"text" },
             { title: '现居住地', model: 'currAddress', type: 'text', intertype:"text" },
             { title: '手机号', model: 'mobile', type: 'text', intertype:"text" },
             { title: '电子邮箱', model: 'email', type: 'text', intertype:"text" },
             { title: '教育经历', model: 'educationDetail', type: 'text', intertype:"text" },
             { title: '自我评价', model: 'evaluation', type: 'text', intertype:"text" },
             { title: '工作性质（全职、兼职、实习生）', model: 'jobNature', type: 'text', intertype:"text" },
             { title: '工作地区', model: 'jobArea', type: 'text', intertype:"text" },
             { title: '工作类型', model: 'jobType', type: 'text', intertype:"text" },
             { title: '工作名称', model: 'jobName', type: 'text', intertype:"text" },
             { title: '期望薪资', model: 'salary', type: 'text', intertype:"text" },
             { title: '工作经验', model: 'experience', type: 'text', intertype:"text" },
             { title: '工作经历', model: 'experienceDetail', type: 'text', intertype:"text" },
             { title: '简历状态', model: 'openStatus', type: 'radio', intertype:"text",
               data: [
                   { label: '私密', value: '0' },
                   { label: '公开', value: '1' },
               ] },
             { title: '身份证号', model: 'idCard', type: 'text', intertype:"text" },
             { title: '审核状态', model: 'auditStatus', type: 'state', intertype:"number", disabled: true,
              data: [
                  { label: '审核通过', value: '1' },
                  { label: '审核未通过', value: '2' },
              ]
             },
        ],
        resumeListRadio: 0,

        dialogAddResumeForm: false,     //打开新增简历
        
        resumeAddModel: {      //  新增简历信息model
            "resumeId":"",
            "name":"",
            "age": "",
            "gender":"",
            "education": '',
            "specialty":"",
            "arrivalTime":"",
            "registerAddress":"",
            "currAddress":"",
            "mobile":"",
            "email":"",
            "educationDetail":"",
            "evaluation":"",
            "jobNature":"",
            "jobArea":"",
            "jobType":"",
            "jobName":"",
            "salary":"",
            "experience":"",
            "experienceDetail":"",
            "openStatus":"1",
            "param1":"新简历",
            "param2":"",
            "param3":"",
            "idCard":"",
            "photo":"",
            "auditStatus": "1",
            "defaultResume": '0'
        },

        deleteResumeInform:[false,false,false],
        // deleteResumeInform2: false,
        // deleteResumeInform3: false,
      }
    },
    computed: {
        globalUserInfo () {
          let usreinfo = this.$store.state.home.globalUserInfo;
          if(usreinfo == null) return;
          this.basicInformatio = usreinfo.jobSeeker;
          this.enterprisebasicInformatio = usreinfo.company;
          this.basicInformatioAccount = usreinfo;
          this.enterpriseBasicInforAccount = usreinfo;
          console.log(usreinfo)
          console.log(usreinfo.jobSeeker)

          return this.$store.state.home.globalUserInfo
        },
    },
    mounted(){
        console.log(BASEURL)
        this.token = localStorage.getItem("user_token").replace(/\"/g, "");
        this.globalUserInfo.jobSeeker !== null && this.getResumeList();
    },
    methods: {
      handleSelect(key, keyPath) {
        // console.log(key, keyPath);
        this.activeIndex = key;
      },

    //   修改求职者基本信息
      handleJobSeekerUpdate(){
          console.log(this.basicInformatio)
          this.$store.dispatch('jobSeekerUpdate',this.basicInformatio);
      },

      handlePreview(file) {
        console.log(file);
      },

    //   开发中提示
      handleJobSeekerUpdatePassword(){
          systemMaintenance()
      },

    //   修改求职者账户信息
      async handleJobSeekerAccountUpdate(){
          console.log(this.basicInformatioAccount)
        //   let res = await this.$store.dispatch('getAuthCode',{mobile: this.basicInformatioAccount.mobile + ''});
        //   console.log(res)
        //   if(res.code !== 0) {
        //       this.$message.error("验证码错误");
        //       return 
        //   }

          if(this.globalUserInfo.company !== null){
            this.$store.dispatch('accountUpdate',this.enterpriseBasicInforAccount);
          }else {
            this.$store.dispatch('accountUpdate',this.basicInformatioAccount);
          }
          
      },

    //   上传头像成功
      handleUpdateAvatarSuccess(response, file, fileList){
          console.log(response, file, fileList)
          this.$store.dispatch('updateAvatar',response);
      },

    //   上传个人简历照片
      handlePersonalPhotoSuccess(response){
        this.resumeModel.photo = response.data;
      },

    //   新增简历照片

      handleAddPersonalPhotoSuccess(response){
        this.resumeAddModel.photo = response.data;
      },

    //    上传头像失败
      handleUpdateAvatarError(err, file, fileList){
          console.log(err)
          this.$message.error(err)
      },

      // 企业更新基本信息
      handleCompanybasicUpdate(){
          console.log(this.basicInformatio)
          this.$store.dispatch('companybasicUpdate',this.enterprisebasicInformatio);
      },

    //   获取简历列表
      async getResumeList(){
          let res = await this.$store.dispatch('getResumeList', this.globalUserInfo.jobSeeker.userId);
          console.log(res)

          if (res.code !== 0 ) return;

          this.resumeList = res.data;
        //   this.resumeList['education'] = parseInt(this.resumeList['education']);
          this.resumeList.map((val,index)=>{
              if(val.defaultResume == 1){
                  this.resumeModel = val;
                  this.resumeListRadio = index;
              }
          })
      },

    //   修改简历
      async handleresumeUpdate(){
          console.log(this.resumeModel)
          if(this.resumeModel.param1.length == 0){
              this.$message.error("简历名称不能为空")
              return;
          }

          let res = await this.$store.dispatch('resumeUpdate', this.resumeModel);
          
          if (res.code !== 0 ) return;
        //   this.getResumeList();
          
      },

      // 切换简历
      hanldeResumeListRadioChange(){
          this.resumeModel = this.resumeList[this.resumeListRadio]
      },

    //   新增简历
      handleAddResume(){
          console.log(this.resumeList.length)
          if(this.resumeList.length ==3){
              this.$message.error("最多添加三份简历");
              return;
          }
          this.dialogAddResumeForm = true;
      },
    

    // 新增简历取消
      handleResumeAddCancel(){
          this.resumeAddModel = {      //  新增简历信息model
            "resumeId":"",
            "name":"",
            "age": "",
            "gender":"",
            "education": '',
            "specialty":"",
            "arrivalTime":"",
            "registerAddress":"",
            "currAddress":"",
            "mobile":"",
            "email":"",
            "educationDetail":"",
            "evaluation":"",
            "jobNature":"",
            "jobArea":"",
            "jobType":"",
            "jobName":"",
            "salary":"",
            "experience":"",
            "experienceDetail":"",
            "openStatus":"1",
            "param1":"新简历",
            "param2":"",
            "param3":"",
            "idCard":"",
            "photo":"",
            "auditStatus": "1",
            "defaultResume":  ''
          };

          this.dialogAddResumeForm = false;
      },

      // 新增简历确定
      async handleResumeAdd(){
          if(this.resumeModel.param1.length == 0){
              this.$message.error("简历名称不能为空")
              return;
          }

          if(this.resumeList.length == 0){
            this.resumeAddModel.defaultResume = '1';
          }

          let res = await this.$store.dispatch('resumeAdd', {
              
              ...this.resumeAddModel, 
              userId: this.globalUserInfo.jobSeeker.userId,
              });
          if (res.code !== 0 ) return;
          await this.getResumeList();
          this.dialogAddResumeForm = false;

      },

    //   删除简历
    async deleteResumeInformSure(val,index){
        console.log(val,index)
        // this.deleteResumeInform.forEach(x=>x = true);
        let res = await this.$store.dispatch('deleteResumeInformSure',val.resumeId);
        if (res.code !== 0 ) return;
        this.getResumeList();
        this.deleteResumeInform = new Array(this.resumeList.length).fill(false);
    },

    // 设置默认简历
    async handleResumeSetDefault(){
        let res = await this.$store.dispatch('resumeSetSetDefault',{
            userId: this.globalUserInfo.jobSeeker.userId,
            resumeId: this.resumeList[this.resumeListRadio].resumeId
        });
        if (res.code !== 0 ) return;
    }


    },
    
     components: {
        UpdateFrom,
        PositionCorrelation
    }
}
</script>

<style lang="less">
.userinfo {
  .congtainer {
      padding: 24px;
      background: #f3f8ff;
  }
  .pages-account-settings-info-main {
    width: 100%;
    height: 100%;
    background-color: #fff;
    display: flex;
    padding-top: 16px;
    padding-bottom: 16px;
    overflow: auto;
    .el-menu-item {
        width: 224px;
        height: 40px;
        line-height: 40px;
    }
    .el-menu-item.is-active {
      background-color: #e6f7ff;
      position: relative;
      &:after{
        content: "";
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        border-right: 3px solid #1890ff;
        transform: scaleY(.0001);
        opacity: 0;
        transition: transform .15s cubic-bezier(.215,.61,.355,1),opacity .15s cubic-bezier(.215,.61,.355,1);
        transition: transform .15s cubic-bezier(.645,.045,.355,1),opacity .15s cubic-bezier(.645,.045,.355,1);
        opacity: 1;
        transform: scaleY(1);
      }
    }

    .main {
        flex: 1 1;
        padding: 8px 40px;
        display: flex;
        .pages-account-settings-info-title {
            font-size: 20px;
            color: rgba(0,0,0,.85);
            line-height: 28px;
            font-weight: 500;
            margin-bottom: 12px;
        }

        .pages-account-settings-base-view-left {
          max-width: 448px;
          min-width: 224px;
          
        }

        .pages-account-settings-base-view-right {
          flex: 1 1;
          padding-left: 104px;
          
        }

    }
  }

  .el-icon-close {
      font-size: 16px;
      cursor: pointer;
      margin-left: 5px;
  }

}
</style>
